using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace Lifter.Gui.Monitor.Controls.Buttons
{
	internal sealed class ButtonXPPainter
	{
		public static Color BorderColor
		{
			get
			{
				return Color.FromArgb(127, 157, 185);
			}
		}
		public static Color DisabledBorderColor
		{
			get
			{
				return Color.FromArgb(201, 199, 186);
			}
		}
		public static Color ButtonBorderColor
		{
			get
			{
				return Color.FromArgb(28, 81, 128);
			}
		}
		public static Color DisabledButtonBorderColor
		{
			get
			{
				return Color.FromArgb(202, 200, 187);
			}
		}
		public static Color DisabledBackColor
		{
			get
			{
				return Color.FromArgb(236, 233, 216);
			}
		}
		public static Color DisabledForeColor
		{
			get
			{
				return Color.FromArgb(161, 161, 146);
			}
		}
		private ButtonXPPainter()
		{
		}
		public static StringFormat GetStringFormat(ContentAlignment contentAlignment)
		{
			if (!Enum.IsDefined(typeof(ContentAlignment), (int)contentAlignment))
			{
				throw new InvalidEnumArgumentException("contentAlignment", (int)contentAlignment, typeof(ContentAlignment));
			}
			StringFormat stringFormat = new StringFormat();
			if (contentAlignment <= ContentAlignment.MiddleCenter)
			{
				switch (contentAlignment)
				{
				case ContentAlignment.TopLeft:
					stringFormat.LineAlignment = StringAlignment.Near;
					stringFormat.Alignment = StringAlignment.Near;
					break;
				case ContentAlignment.TopCenter:
					stringFormat.LineAlignment = StringAlignment.Near;
					stringFormat.Alignment = StringAlignment.Center;
					break;
				case (ContentAlignment)3:
					break;
				case ContentAlignment.TopRight:
					stringFormat.LineAlignment = StringAlignment.Near;
					stringFormat.Alignment = StringAlignment.Far;
					break;
				default:
					if (contentAlignment != ContentAlignment.MiddleLeft)
					{
						if (contentAlignment == ContentAlignment.MiddleCenter)
						{
							stringFormat.LineAlignment = StringAlignment.Center;
							stringFormat.Alignment = StringAlignment.Center;
						}
					}
					else
					{
						stringFormat.LineAlignment = StringAlignment.Center;
						stringFormat.Alignment = StringAlignment.Near;
					}
					break;
				}
			}
			else
			{
				if (contentAlignment <= ContentAlignment.BottomLeft)
				{
					if (contentAlignment != ContentAlignment.MiddleRight)
					{
						if (contentAlignment == ContentAlignment.BottomLeft)
						{
							stringFormat.LineAlignment = StringAlignment.Far;
							stringFormat.Alignment = StringAlignment.Near;
						}
					}
					else
					{
						stringFormat.LineAlignment = StringAlignment.Center;
						stringFormat.Alignment = StringAlignment.Far;
					}
				}
				else
				{
					if (contentAlignment != ContentAlignment.BottomCenter)
					{
						if (contentAlignment == ContentAlignment.BottomRight)
						{
							stringFormat.LineAlignment = StringAlignment.Far;
							stringFormat.Alignment = StringAlignment.Far;
						}
					}
					else
					{
						stringFormat.LineAlignment = StringAlignment.Far;
						stringFormat.Alignment = StringAlignment.Center;
					}
				}
			}
			return stringFormat;
		}
		public static void DrawRoundedRectangle(Graphics g, Pen p, Rectangle rc, Size size)
		{
			SmoothingMode smoothingMode = g.SmoothingMode;
			g.SmoothingMode = SmoothingMode.AntiAlias;
			g.DrawLine(p, rc.Left + size.Width / 2, rc.Top, rc.Right - size.Width / 2, rc.Top);
			g.DrawArc(p, rc.Right - size.Width, rc.Top, size.Width, size.Height, 270, 90);
			g.DrawLine(p, rc.Right, rc.Top + size.Height / 2, rc.Right, rc.Bottom - size.Height / 2);
			g.DrawArc(p, rc.Right - size.Width, rc.Bottom - size.Height, size.Width, size.Height, 0, 90);
			g.DrawLine(p, rc.Right - size.Width / 2, rc.Bottom, rc.Left + size.Width / 2, rc.Bottom);
			g.DrawArc(p, rc.Left, rc.Bottom - size.Height, size.Width, size.Height, 90, 90);
			g.DrawLine(p, rc.Left, rc.Bottom - size.Height / 2, rc.Left, rc.Top + size.Height / 2);
			g.DrawArc(p, rc.Left, rc.Top, size.Width, size.Height, 180, 90);
			g.SmoothingMode = smoothingMode;
		}
		public static void DrawBorder(Graphics g, int x, int y, int width, int height)
		{
			g.DrawRectangle(new Pen(ButtonXPPainter.BorderColor, 0f), x, y, width, height);
		}
		public static void EraseExcessOldDropDown(Graphics g, Rectangle newButton)
		{
			g.FillRectangle(new SolidBrush(SystemColors.Window), newButton.X - 2, newButton.Y, 2, newButton.Height + 1);
		}
	}
}
